<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<p>Welcome to JBoss Example Web Application</p>

<%@page import="deng.jbe.ejb.*" %>
<%@page import="org.apache.log4j.Logger" %>
<%@page import="javax.ejb.*" %>
<%@page import="javax.naming.*" %>
<%@page import="java.util.*" %>
<%
Logger logger = Logger.getLogger("deng.jbe.web.invokeLocalEjb.jsp");
logger.info("Looking up local bean");
InitialContext ctx = new InitialContext();
final MyStatelessLocal myBean = (MyStatelessLocal)ctx.lookup("jbe-ear/MyStatelessBean/local");

List<Thread> threads = new ArrayList<Thread>();
for (int i = 0; i < 50; i ++) {
	logger.info("Invoking thread#" + i);
	threads.add(new Thread() {

		@Override
		public void run() {
			myBean.runIt();
		}
		
	});
}

for(Thread t : threads) {
	t.start();
}

logger.info("done.");
%>

<p>server time: <%= new java.util.Date().toString() %></p>
</body>
</html>